#!/usr/bin/env bash

main()
{
    local split="----------------------------------------"

    local s="  line 1     aaa   bbbb,  line 2  xxx     yyy    ,line 3,    line 4   "
    echo '$s: ('$s')'
    echo '"$s": ('"$s"')'
    echo

    echo 'read -a arr <<<"$s"'
    IFS=, read -a arr <<<"$s"    # ""完整保留字符串空格等，否则会合并
    echo "IFS: ($IFS)"
#    OIFS=$IFS
#    local -a arr
#    IFS=, arr=($s)           # 不会恢复IFS
#    IFS=$OIFS
    for line in "${arr[@]}"
    do
        echo "($line)"
    done
    echo $split
}

main
